<?php
/**
 * Created by @baidu-aip
 * Author: ylang
 * Time: 2022/2/24 16:31
 */

namespace Hedgehog\BaiduAip\Api;

use Hedgehog\BaiduAip\Api;


/**
 * 图像识别
 * @method  advanced_general(string $image, array $option = [])
 * @method  object_detect(string $image, array $option = [])
 * @method  animal(string $image, array $option = [])
 * @method  plant(string $image, array $option = [])
 * @method  logo(string $image, array $option = [])
 * @method  classify_ingredient(string $image, array $option = [])
 * @method  realtime_search_dish(string $image, array $option = [])
 * @method  dish(string $image, array $option = [])
 * @method  redwine(string $image, array $option = [])
 * @method  currency(string $image, array $option = [])
 * @method  landmark(string $image, array $option = [])
 * @method  multi_object_detect(string $image, array $option = [])
 * @method  realtime_search_redwine(string $image, array $option = [])
 */
class ImageClassify extends Api
{

    protected array $funcUrl = [
        'advanced_general' => 'image-classify/v2/advanced_general',
        'object_detect' => 'image-classify/v1/object_detect',
        'animal' => 'image-classify/v1/animal',
        'plant' => 'image-classify/v1/plant',
        'logo' => 'image-classify/v2/logo',
        'classify_ingredient' => 'image-classify/v1/classify/ingredient',
        'realtime_search_dish' => 'image-classify/v1/realtime_search/dish/add',
        'dish' => 'image-classify/v2/dish',
        'redwine' => 'image-classify/v1/redwine',
        'currency' => 'image-classify/v1/currency',
        'landmark' => 'image-classify/v1/landmark',
        'multi_object_detect' => 'image-classify/v1/multi_object_detect',
        'realtime_search_redwine' => 'image-classify/v1/multi_object_detect',
    ];


    public function __call($name, $arguments)
    {
        return $this->parseJson($this->funcUrl[$name], array_merge([
            'image' => base64_encode($arguments[0]),
        ], $arguments[1] ?? []));
    }

}